home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-04 | 4.6 KB | 151 lines | [TEXT/KAHL] |
- /***************************************************** IMPLEMENTATION
- DATE: 9/21/93
- AUTHOR: Eric R. Rosé
-
- CLASS: CPPTextWindow
-
- SUPERCLASS: CPPWindow, CPPText
-
- This C++ class manages a text editing window
-
- ********************************************************************/
-
- #include <CPPTEWindow.h>
- #include <Commands.h>
- #include <MathTools.h>
-
- /*-----------------------------------------------------------------*/
- /*------------------------ PUBLIC METHODS -------------------------*/
- /*-----------------------------------------------------------------*/
-
- CPPTEWindow::CPPTEWindow (CPPWindowManager *theManager, int ResID,
- Boolean HScroll, Boolean VScroll,
- int Font, int FSize) :
- CPPWindow (theManager, ResID),
- CPPFilterText ((CPPWindow *)this, 32767, HScroll, VScroll,
- pass, (int)all, Font, FSize)
- /* most of the work is done in the initialization phase */
- {
- SetMinMaxSize(70, 70, kPageWidth + kSBarWidth,
- kPageHeight + kSBarWidth);
- SetMinSize (70, 70);
- SetMaxSize (kPageWidth + kSBarWidth, kPageHeight + kSBarWidth);
- }
-
- /*-----------------------------------------------------------------*/
-
- CPPTEWindow::CPPTEWindow (CPPWindowManager *theManager,
- Rect *bounds, StringPtr title, Boolean isVisible,
- int windowKind, Boolean hasGoAway, int RefCon,
- Boolean HScroll, Boolean VScroll,
- int Font, int FSize) :
- CPPWindow (theManager, bounds, title, isVisible,
- windowKind, hasGoAway, RefCon),
- CPPFilterText ((CPPWindow *)this, 32767, HScroll, VScroll,
- pass, (int)all, Font, FSize)
- /* most of the work is done in the initialization phase */
- {
- SetMinMaxSize(70, 70, kPageWidth + kSBarWidth,
- kPageHeight + kSBarWidth);
- SetMinSize (70, 70);
- SetMaxSize (kPageWidth + kSBarWidth, kPageHeight + kSBarWidth);
- }
-
- /*-----------------------------------------------------------------*/
-
- CPPTEWindow::~CPPTEWindow (void)
- {
-
- }
-
- /*-----------------------------------------------------------------*/
-
- char *CPPTEWindow::ClassName (void)
- {
- return "CPPTEWindow";
- }
-
- /*-----------------------------------------------------------------*/
-
- Boolean CPPTEWindow::DoCommand (short commandID)
- /* the default method sends the command to the target of the */
- /* window. */
- /* SUBCLASS SHOULD OVERRIDE */
- {
- return CPPFilterText::DoCommand(commandID);
- }
-
- /*-----------------------------------------------------------------*/
- /*---------------------- PROTECTED METHODS ------------------------*/
- /*-----------------------------------------------------------------*/
-
- void CPPTEWindow::Activate (void)
- /* do the necessary bookkeeping to keep track of the window's state */
- {
- CPPWindow::Activate();
-
- if (this->theWindow)
- this->WisActive = TRUE;
- }
-
- /*-----------------------------------------------------------------*/
-
- void CPPTEWindow::Deactivate (void)
- /* do the necessary bookkeeping to keep track of the window's state */
- {
- if (this->theWindow)
- this->WisActive = FALSE;
- }
-
- /*-----------------------------------------------------------------*/
-
- void CPPTEWindow::DoUserClick (EventRecord *theEvent)
- /* instance specific handler for clicking in the window */
- /* SUBCLASS SHOULD OVERRIDE */
- {
- CPPText::DoClick (theEvent); // textedit object method
- }
-
- /*-----------------------------------------------------------------*/
-
- void CPPTEWindow::DoUserUpdate (void)
- /* instance specific handler for drawing the window's contents */
- /* SUBCLASS SHOULD OVERRIDE */
- {
- this->Draw(); // textedit object method
- }
-
- /*-----------------------------------------------------------------*/
-
- void CPPTEWindow::DoUserIdle (void)
- /* instance specific handler for idling when the window is */
- /* the frontmost window */
- /* SUBCLASS SHOULD OVERRIDE */
- {
- if (this->TextBlock && this->WisActive)
- CPPText::DoIdle(); // textedit object method
- }
-
- /*-----------------------------------------------------------------*/
-
- Boolean CPPTEWindow::DoUserKey (EventRecord *theEvent)
- /* instance specific handler for handling a keypress */
- /* return TRUE if we handled the key, FALSE otherwise */
- /* SUBCLASS SHOULD OVERRIDE */
- {
- char theKey;
-
- theKey = theEvent->message & charCodeMask;
- return this->DoKey(theKey, theEvent->modifiers, theEvent->what);
- }
-
- /*-----------------------------------------------------------------*/
-
- void CPPTEWindow::DoUserChangeSize (short newWidth, short newHeight)
- /* instance specific handler for resizing the window; use this */
- /* opportunity to change the size of the scrollbars and TE area */
- {
- CPPText::Resize (newWidth, newHeight); // textedit object method
- }
-
-